import request from  '@/utils/request.js'

export function findAddrByPhone({
	phone
    }) {
    return request({
        url: '/api/v1/inner/findMessageByPhone?phone='+phone,
        method: 'get'
    })
}

export function findOrderInfos({
	merchantCode
    }) {
    return request({
        url: '/api/v1/inner/findOrderInfos?merchantCode='+merchantCode,
        method: 'get'
    })
}

export function searchPayment({
        pageNo ,
        pageSize ,
        wechatno 
    }) {
    return request({
        url: '/api/v1/inner/searchPayment?pageNo='+pageNo+"&pageSize="+pageSize+"&wechatno="+wechatno,
        method: 'get'
    })
}

export function returnMoney({
    orderNo  ,
	password ,
	merchantNo ,
	remark 
}) {
    return request({
        url: '/api/v1/bank/returnMoney',
        method: 'post',
        data : {
            orderNo : orderNo ,
            password : password ,
            merchantNo : merchantNo ,
            remark : remark 
        }
    })
}

// 查询客诉信息
export function searchCustomer({
    pageNo  ,
	pageSize ,
	uname ,
    phone ,
    orderNo,
    orderNoEnd,
    password ,
    status
}) {
    return request({
        url: '/api/v1/cs/manage/searchCustomer?pageNo='+pageNo+
                                                    "&pageSize="+pageSize+
                                                    "&uname="+uname+
                                                    "&phone="+phone+
                                                    "&orderNo="+orderNo+
                                                    "&orderNoEnd="+orderNoEnd+
                                                    "&password="+password+
                                                    "&status="+status,
        method: 'get'
    })
}


// NEW  
export function phoneOrderflow({phone}) {
    return request({
        url: '/api/v1/cs/manage/orderflow?phone='+phone,
        method: 'get'
    })
}

export function searchPaymentDetailList({ordercode}) {
    return request({
        url: '/api/v1/cs/manage/searchPaymentDetailList?ordercode='+ordercode,
        method: 'get'
    })
}

export function searchPaymentDetailBythridpartyno({thridpartyno}) {
    return request({
        url: '/api/v1/cs/manage/searchPaymentDetailBythridpartyno?thridpartyno='+thridpartyno,
        method: 'get'
    })
}

export function updateCustomerInfo({
    id,
	password ,
	status ,
	cptag  
}) {
    return request({
        url: '/api/v1/cs/manage/updateCustomerInfo',
        method: 'post',
        data : {
            id : id ,
            password : password ,
            status : status ,
            cptag : cptag 
        }
    })
}

export function ksstatus() {
    return request({
        url: '/api/v1/cs/manage/ksstatus',
        method: 'get'
    })
}

export function finaceWjnshStatus({datestr,remark}) {
    return request({
        url: '/api/v1/cs/finance/finaceWjnshStatus?datestr='+datestr+'&remark='+remark,
        method: 'get'
    })
}

//responseType: 'arraybuffer'

export function downloadKsExcel({from,to,status}) {
    return request({
        url: '/api/v1/cs/excel/ks?from='+from+'&to='+to+'&status='+status,
        method: 'get',
        responseType: 'arraybuffer'
    })
}

export function downloadKzExcel({sdate,edate,systemcode,sku}) {
    return request({
        url: '/api/v1/cs/excel?sdate='+sdate+'&edate='+edate+'&systemcode='+systemcode+'&sku='+sku,
        method: 'get',
        responseType: 'arraybuffer'
    })
}

export function getAllProducts() {
    return request({
        url: '/api/v1/cs/manage/products',
        method: 'get'
    })
}


export function orderInfo(ordercode) {
    return request({
        url: '/api/v1/cs/manage/orderInfo?ordercode='+ordercode,
        method: 'get'
    })
}



